<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>返回与时区相关的定位信息</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="datetimezone.construct.html">« DateTimeZone::__construct</a></li>
      <li style="float: right;"><a href="datetimezone.getname.html">DateTimeZone::getName »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.datetimezone.html">DateTimeZone</a></li>
    <li>返回与时区相关的定位信息</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="datetimezone.getlocation" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">DateTimeZone::getLocation</h1>
  <h1 class="refname">timezone_location_get</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">DateTimeZone::getLocation</span> -- <span class="refname">timezone_location_get</span> &mdash; <span class="dc-title">返回与时区相关的定位信息</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-datetimezone.getlocation-description">
  <h3 class="title">说明</h3>
  <p class="para">面向对象风格</p>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>DateTimeZone::getLocation</strong></span>(): <span class="type"><span class="type">array</span>|<span class="type"><span class="type false">false</span></span></span></div>

  <p class="para rdfs-comment">过程化风格</p>
  <div class="methodsynopsis dc-description"><span class="methodname"><a href="function.timezone-location-get.html" class="methodname">timezone_location_get</a></span>(<span class="methodparam"><span class="type"><a href="class.datetimezone.html" class="type DateTimeZone">DateTimeZone</a></span> <code class="parameter">$object</code></span>): <span class="type"><span class="type">array</span>|<span class="type"><span class="type false">false</span></span></span></div>

  <p class="para rdfs-comment">
   返回时区的位置信息，包含国家代码，经纬度和注释。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-datetimezone.getlocation-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    <dt>

<code class="parameter">object</code></dt>
<dd>
<p class="para">仅过程化风格：由 <span class="function"><a href="function.timezone-open.html" class="function">timezone_open()</a></span> 返回的
<span class="classname"><a href="class.datetimezone.html" class="classname">DateTimeZone</a></span> 对象。</p></dd>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-datetimezone.getlocation-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   包含时区的位置信息的数组 或者在失败时返回 <strong><code>false</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-datetimezone.getlocation-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2043">
    <p><strong>示例 #1 <span class="function"><strong>DateTimeZone::getLocation()</strong></span> 函数的范例：</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$tz&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">DateTimeZone</span><span style="color: #007700">(</span><span style="color: #DD0000">"Europe/Prague"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$tz</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getLocation</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">timezone_location_get</span><span style="color: #007700">(</span><span style="color: #0000BB">$tz</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Array
(
    [country_code] =&gt; CZ
    [latitude] =&gt; 50.08333
    [longitude] =&gt; 14.43333
    [comments] =&gt;
)
Array
(
    [country_code] =&gt; CZ
    [latitude] =&gt; 50.08333
    [longitude] =&gt; 14.43333
    [comments] =&gt;
)
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-datetimezone.getlocation-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member"><span class="function"><a href="datetimezone.listidentifiers.html" class="function" rel="rdfs-seeAlso">DateTimeZone::listIdentifiers()</a> - 返回包含了所有时区标识符的数字索引数组</span>，以获得所有支持的时区标识符的完整或部分列表</li>
  </ul>
 </div>


</div></div></div></body></html>